package org.example.sudoku;

import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class NotificationSudoku extends IntentService{

	private static NotificationSudoku ref=null;
	
	String ns = Context.NOTIFICATION_SERVICE;
	NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

	int icon = R.drawable.icon;
	CharSequence tickerText = "Hello";
	long when = System.currentTimeMillis();

	Notification notification = new Notification(icon, tickerText, when);

	Context context = getApplicationContext();
	CharSequence contentTitle = "Timer";
	CharSequence contentText = "Hello world";
	Intent notificationIntent = new Intent(this, NotificationSudoku.class);
	PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
			notificationIntent, 0);

	public static void setContentText(String contentText) {
		getNSRef().contentText = contentText;
	}

	private static NotificationSudoku getNSRef() {
		if(ref!=null)ref=new NotificationSudoku();
		return ref;
	}

	public void setContentTitle(String contentTitle) {
		this.contentTitle = contentTitle;
	}

	private static int HELLO_ID = 1;

	public NotificationSudoku() {
			super("NotificationSudoku");
			if(getNSRef()==null)ref=this;
	}

	public void notifi() {
		notification.setLatestEventInfo(context, contentTitle, contentText,
				contentIntent);
		mNotificationManager.notify(HELLO_ID, notification);

	}

	@Override
	protected void onHandleIntent(Intent intent) {
				notifi();
		
	}


}
